﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ArchiveQuery.aspx.cs" Inherits="CentralOffice.WebClient.Archives.ArchiveQuery" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title></title>
    <link rel="stylesheet" type="text/css" href="../theme/2/style.css" />
    <script type="text/javascript" src="../inc/js/ccorrect_btn.js"></script>
</head>
<body  class="bodycolor" topmargin="5">
<div style="margin-top:10px;"><img src="../images/sys_config.gif" WIDTH="22" HEIGHT="20" align="absmiddle" /><span class="big3">档案查询</span></div>
     <form id="form1" runat="server"><ajaxToolkit:ToolkitScriptManager runat="server" ID="sm"  />
    <script type="text/javascript" src="../inc/js/ProvinceCity.js"></script>
    <asp:ObjectDataSource ID="odsCategory" runat="server" SelectMethod="GetAllWithEmpty" TypeName="CentralOffice.Archive.BusinessActions.ArchiveCategory" DeleteMethod="Delete"></asp:ObjectDataSource>
    <table class="TableBlock" width="100%" align="center">
<tr>
    <td class="TableData">项目名称：</td><td class="TableData" ><asp:TextBox ID="txtName" runat="server" CssClass="BigInput" ></asp:TextBox></td>
    <td class="TableData">档案类型：</td><td class="TableData" ><asp:DropDownList ID="ddlCategory" DataSourceID="odsCategory" DataTextField="Name" DataValueField="Id" runat="server" EnableViewState="false"></asp:DropDownList></td>
    <td class="TableData">档案号：</td><td class="TableData"><asp:TextBox ID="txtCode" runat="server" CssClass="BigInput" ></asp:TextBox></td>
</tr>
<tr>
    
    <td class="TableData">密级：</td><td class="TableData"><asp:DropDownList ID="ddlSecretLevel" runat="server"></asp:DropDownList></td> 
    <td class="TableData">合同号：</td><td class="TableData"><asp:TextBox ID="txtContractCode" runat="server" CssClass="BigInput" ></asp:TextBox></td>
    <td class="TableData">省份：</td><td class="TableData"><select id="province" name="province"></select><asp:HiddenField ID="txtProvince" runat="server" EnableViewState="false" /> </td>   
</tr>
<tr>
    <td class="TableData">结构形式：</td><td class="TableData"><asp:TextBox ID="txtConstructForm" runat="server" CssClass="BigInput" ></asp:TextBox></td>
    <td class="TableData">规模：</td><td class="TableData"><asp:TextBox ID="txtScale" runat="server" CssClass="BigInput" ></asp:TextBox></td>
    <td class="TableData">市县：</td><td class="TableData"><select id="city" name="city"></select><asp:HiddenField ID="txtCity" runat="server" EnableViewState="false" /></td>  
</tr>
<tr>
    <td class="TableData">客户名称：</td><td class="TableData"><asp:TextBox ID="txtCustomer" runat="server" CssClass="BigInput" ></asp:TextBox></td>
    <td class="TableData">联系人：</td><td class="TableData"><asp:TextBox ID="txtContact" runat="server" CssClass="BigInput" ></asp:TextBox></td>
    <td class="TableData">存档日期从：</td><td class="TableData"><asp:TextBox ID="txtFiledDateStart" runat="server" CssClass="BigInput" ></asp:TextBox>&nbsp;<img onclick="WdatePicker({el:$dp.$('txtFiledDate'), dateFmt:'yyyy-MM-dd'})" src="../inc/js/My97DatePicker/skin/datePicker.gif" width="16" height="22" align="absmiddle" /></td>
</tr>
<tr>
    <td class="TableData">电话：</td><td class="TableData"><asp:TextBox ID="txtTelephone1" runat="server" CssClass="BigInput" ></asp:TextBox></td>
    <td class="TableData">地址：</td><td class="TableData"><asp:TextBox ID="txtAddress" runat="server" CssClass="BigInput" ></asp:TextBox></td>
    <td class="TableData">到：</td><td class="TableData"><asp:TextBox ID="txtFiledDateEnd" runat="server" CssClass="BigInput" ></asp:TextBox>&nbsp;<img onclick="WdatePicker({el:$dp.$('txtFiledDate'), dateFmt:'yyyy-MM-dd'})" src="../inc/js/My97DatePicker/skin/datePicker.gif" width="16" height="22" align="absmiddle" /></td>
</tr>
<tr>
    
    <td class="TableData">设计阶段：</td><td class="TableData"><asp:TextBox ID="txtDesignStage" runat="server" CssClass="BigInput" ></asp:TextBox></td>  
    <td class="TableData">所属片区：</td><td class="TableData"><asp:TextBox ID="txtBelongedTo" runat="server" CssClass="BigInput" ></asp:TextBox></td>
    <td class="TableData">项目经理：</td><td class="TableData"><asp:TextBox ID="txtProjectManager" runat="server" CssClass="BigInput" ></asp:TextBox></td>  
</tr>

<tr>
    <td class="TableData">通用搜索条件：</td><td class="TableData" colspan="5"><asp:TextBox ID="txtSearchText" runat="server" CssClass="BigInput" Width="96%" ></asp:TextBox></td>  
</tr>

<tr>
   <td nowrap class="TableControl" colspan="3" align="center"><asp:Button ID="btnQuery" runat="server" Text="查询" OnClientClick="return clientCheck();"  CssClass="BigButton" OnClick="btnQuery_Click" /></td>
   <td nowrap class="TableControl" colspan="3" align="center"><input type="button" value="添加" class="BigButton" onclick="window.location='ArchiveAdd.aspx?operation=add';"><%--<input type="submit" value="复制" class="BigButton" style="margin-left:20px;">--%></td>
</tr>
</table>

<div style="margin-top:20px; margin-left:8px;"><h3>查询结果：</h3></div>
<div style="text-align:center">
<asp:UpdatePanel UpdateMode="Conditional" ID="upArchive" runat="server" ChildrenAsTriggers="true">
<ContentTemplate>
<huag:OAGridView  id="gv" runat="server" DataKeyNames="Id" AllowSorting="True" skinid="PagingGridView" Width="100%"  DataSourceID="odsArchive" EnableViewState="false" ConfirmDelete="true" ><%--OnDataExport="gv_DataExport"--%>
   <Columns>
       <%--<asp:BoundField DataField="Name" HeaderText="名称" SortExpression="Name"  />--%>
       <asp:HyperLinkField DataTextField="Name" DataNavigateUrlFormatString="ArchiveView.aspx?id={0}" DataNavigateUrlFields="Id" HeaderText="项目名称" target="_blank" SortExpression="Name"/>
       <asp:BoundField DataField="ContractCode" HeaderText="合同号" SortExpression="ContractCode" />
       <asp:BoundField DataField="Category" HeaderText="类型" SortExpression="Category" />
       <asp:BoundField DataField="SecretLevel" HeaderText="密级" SortExpression="SecretLevel" />
       <asp:BoundField DataField="City" HeaderText="市县" SortExpression="City" />
       <asp:BoundField DataField="FiledDate" HeaderText="存档日期" DataFormatString="{0:yyyy-MM-dd}" HtmlEncode="false" SortExpression="FiledDate" />
       <asp:BoundField DataField="Customer" HeaderText="客户" SortExpression="Customer" />
       <asp:BoundField DataField="Scale" HeaderText="规模"  SortExpression="Scale" />
       <asp:BoundField DataField="ConstructForm" HeaderText="结构形式" SortExpression="ConstructForm" />
       <asp:BoundField DataField="DesignStage" HeaderText="设计阶段"  SortExpression="DesignStage" />
       <asp:BoundField DataField="BelongedTo" HeaderText="所属片区" SortExpression="BelongedTo" />
       <asp:BoundField DataField="ProjectManager" HeaderText="项目经理"  SortExpression="ProjectManager" />
       <%--<asp:BoundField DataField="Keywords" HeaderText="文档关键字" />
       <asp:BoundField DataField="Subtitle" HeaderText="文档子标题" />--%>
       
       <asp:HyperLinkField  DataNavigateUrlFormatString="ArchiveUpdate.aspx?id={0}&categoryid={1}&operation=edit" DataNavigateUrlFields="Id,CategoryId" Text="编辑" />
       <asp:CommandField ShowDeleteButton="True" DeleteText="删除" />
       <asp:HyperLinkField  DataNavigateUrlFormatString="ArchiveAuthority.aspx?id={0}" DataNavigateUrlFields="Id" Text="修改阅读权" />
   </Columns>
</huag:OAGridView>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="btnQuery" />
</Triggers>
</asp:UpdatePanel>

<%--MaximumRowsParameterName="maxRows" StartRowIndexParameterName="startIndex"<asp:Parameter Name="startIndex" Type="Int32" /><asp:Parameter Name="maxRows" Type="Int32" /> <asp:Parameter Name="sortExpression" Type="String"/> --%>
<asp:ObjectDataSource id="odsArchive" runat="server" EnablePaging="True" 
 TypeName="CentralOffice.Archive.BusinessActions.Archive" 
 SelectMethod="GetPaged" SelectCountMethod="GetCount"
 DeleteMethod="DeleteById"
 SortParameterName="sortExpression" OnSelecting="odsArchive_Selecting">
    <SelectParameters>
      <asp:Parameter Name="whereClause" Type="String" />
    </SelectParameters>
</asp:ObjectDataSource>
</div>
    </form>

<script type="text/javascript">
    //<![CDATA[
    populateProvince(document.getElementById("province"), document.getElementById("city"), true);

    function clientCheck() {
        if (document.getElementById("province").selectedIndex > 0) {
            var provinceName = province[document.getElementById("province").value - 1];
            var cityNames = city[document.getElementById("province").value - 1]; //
            var cityName = cityNames[document.getElementById("city").value % 1000];

            document.getElementById("<%=txtProvince.ClientID %>").value = provinceName;
            document.getElementById("<%=txtCity.ClientID %>").value = cityName;

            //alert(provinceName);
            //alert(cityName);
        }

        var startDate = document.getElementById('<%= txtFiledDateStart.ClientID  %>');
        if (!isDate(startDate)) {
            alert('起始时间格式不正确！');
            return false;
        }
        var endDate = document.getElementById('<%= txtFiledDateEnd.ClientID  %>');
        if (!isDate(endDate)) {
            alert('截至时间格式不正确！');
            return false;
        }

        if (!isInteger(document.getElementById('<%= txtScale.ClientID  %>').value)) {
            alert('规模必须为正整数！');
            return false;
        }
        
    }
    //]]>
</script>

    <script type="text/javascript" src="../inc/js/My97DatePicker/WdatePicker.js"></script>
</body>
</html>
